<%@ page contentType="text/html;charset=UTF-8" %>
<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<html>
<head>
    <meta name="renderer" content="webkit|ie-comp|ie-stand">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport"
          content="width=device-width,initial-scale=1,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no"/>
    <!--[if lt IE 9]>
    <script type="text/javascript" src="lib/html5shiv.js"></script>
    <script type="text/javascript" src="lib/respond.min.js"></script>
    <![endif]-->
    <link rel="stylesheet" type="text/css" href="static/h-ui/css/H-ui.min.css"/>
    <link rel="stylesheet" type="text/css" href="static/h-ui.admin/css/H-ui.admin.css"/>
    <link rel="stylesheet" type="text/css" href="lib/Hui-iconfont/1.0.8/iconfont.css"/>
    <link rel="stylesheet" type="text/css" href="static/h-ui.admin/skin/default/skin.css" id="skin"/>
    <link rel="stylesheet" type="text/css" href="static/h-ui.admin/css/style.css"/>
    <!-- 引入样式 -->
    <link rel="stylesheet" href="static/element/index.css">
    <%--    <link rel="stylesheet" href="https://unpkg.com/element-ui/lib/theme-chalk/index.css">--%>
    <!--[if IE 6]>
    <script type="text/javascript" src="lib/DD_belatedPNG_0.0.8a-min.js"></script>
    <script>DD_belatedPNG.fix('*');</script>
    <![endif]-->
    <title></title>
    <style>
        .fail .layui-layer-content {
            background-color: brown;
            color: #eee;
            width: 480px;
            height: 30px;
            text-align: center;
        }

        .succeed .layui-layer-content {
            background-color: #0061A8;
            color: #eee;
            width: 480px;
            height: 30px;
            text-align: center;
        }

        * {
            padding: 0;
            margin: 0;
        }

        html {
            overflow-y: hidden;
        }

        body, html {
            width: 100%;
            height: 100%;
        }

        body {
            display: flex;
            flex-flow: column;
        }

        .fheader {
            height: 1%;
            min-height: 50px;
        }

        .fsection {
            /*flex-grow: 1;*/
            display: flex;
            flex-flow: row;
            margin-top: 10px;
            /*height: 99%;*/
            min-height: 0;
        }

        .farticle {
            flex: 1;
            padding: 1px;
        }

        .el-table__body tr:hover > td {
            background-color: #DFDFDF !important;
            cursor: default
        }
    </style>
</head>
<body>
<div id="app">
    <div class="fheader" style="padding: 0;margin: 0 ">
        <nav class="breadcrumb" style="height: 100%; padding: 0;margin-top: 8px ">
            <div class="l" style="margin-left: 20px; padding-top: 5px" v-loading.fullscreen.lock="fullscreenLoading">
                查询内容：
                <el-autocomplete
                        class="inline-input"
                        v-model="state2"
                        :fetch-suggestions="querySearch"
                        placeholder="请输入内容"
                        :trigger-on-focus="false"
                        clearable
                        @select="handleSelect">
                </el-autocomplete>
                <a class="btn btn-warning radius" style="line-height:1.6em; margin-left: 8px" @click="fReset()"
                   title="重置">重置刷新</a>
                <button style="margin-left: 8px;" @click="fCz()" class="btn btn-success radius" name="">
                    导出报表
                </button>
            </div>
            <span class="r" style="padding-top: 6px;">总记录数：[<strong>{{idSum3}}</strong> 条] </span>
        </nav>
    </div>
    <div class="fsection">
        <div class="farticle">
            <div style="height: 100%; width: 100%; overflow: scroll; float: left; overflow-x: hidden;">
                <el-table :data="tableData" stripe border style="width: 100%" :height="tableHeightL" empty-text="没有数据"
                          :header-cell-style="tableHeaderCellStyleL" :cell-style="tableCellStyleL">
                    <el-table-column prop="VALUE02" label="工号" width="80"></el-table-column>
                    <el-table-column prop="VALUE03" label="姓名" width="85"></el-table-column>
                    <el-table-column prop="VALUE04" label="部门" width="85"></el-table-column>
                    <el-table-column prop="VALUE05" label="消费类别" width="100"></el-table-column>
                    <el-table-column prop="VALUE06" label="电话号码" width="105"></el-table-column>
                    <el-table-column prop="VALUE11" label="原卡余额" width="80">
                        <template slot-scope="scope">
                            <span v-if="scope.row.VALUE11 === '0.00'"></span>
                            <span v-else>{{scope.row.VALUE11}}</span>
                        </template>
                    </el-table-column>

                    <el-table-column prop="VALUE14" label="虚拟退款额" width="90">
                        <template slot-scope="scope">
                            <span v-if="scope.row.VALUE15 === '已处理'"></span>
                            <span v-else>{{scope.row.VALUE14}}</span>
                        </template>
                    </el-table-column>

                    <el-table-column prop="VALUE12" label="789消费额" width="80">
                        <%--                        <template slot-scope="scope">--%>
                        <%--                            <span v-if="scope.row.VALUE12 === '0.00'"></span>--%>
                        <%--                            <span v-else>{{scope.row.VALUE12}}</span>--%>
                        <%--                        </template>--%>
                    </el-table-column>
                    <el-table-column prop="VALUE13" label="789消费差额" width="100">
                        <%--                        <template slot-scope="scope">--%>
                        <%--                            <span v-if="scope.row.VALUE13 === '0.00'"></span>--%>
                        <%--                            <span v-else>{{scope.row.VALUE13}}</span>--%>
                        <%--                        </template>--%>
                    </el-table-column>
                    <el-table-column prop="VALUE07" :label="sh1st" width="120">
                        <template slot-scope="scope">
                            <span v-if="scope.row.VALUE07 === '0.00'"></span>
                            <span v-else>{{scope.row.VALUE07}}</span>
                        </template>
                    </el-table-column>
                    <el-table-column prop="VALUE08" :label="sh1cs" width="120">
                        <template slot-scope="scope">
                            <span v-if="scope.row.VALUE08 === '0.00'"></span>
                            <span v-else>{{scope.row.VALUE08}}</span>
                        </template>
                    </el-table-column>
                    <el-table-column prop="VALUE09" :label="sh2st" width="120">
                        <template slot-scope="scope">
                            <span v-if="scope.row.VALUE09 === '0.00'"></span>
                            <span v-else>{{scope.row.VALUE09}}</span>
                        </template>
                    </el-table-column>
                    <el-table-column prop="VALUE10" :label="sh2cs" width="120">
                        <template slot-scope="scope">
                            <span v-if="scope.row.VALUE10 === '0.00'"></span>
                            <span v-else>{{scope.row.VALUE10}}</span>
                        </template>
                    </el-table-column>

                </el-table>
            </div>
        </div>
    </div>
</div>

<!--_footer 作为公共模版分离出去-->
<script type="text/javascript" src="lib/jquery/1.9.1/jquery.min.js"></script>
<script type="text/javascript" src="lib/layer/2.4/layer.js"></script>
<script type="text/javascript" src="static/h-ui/js/H-ui.min.js"></script>
<script type="text/javascript" src="static/h-ui.admin/js/H-ui.admin.js"></script> <!--/_footer 作为公共模版分离出去-->

<!--请在下方写此页面业务相关的脚本-->
<script type="text/javascript" src="lib/My97DatePicker/4.8/WdatePicker.js"></script>
<script type="text/javascript" src="lib/datatables/1.10.0/jquery.dataTables.min.js"></script>
<script type="text/javascript" src="lib/laypage/1.2/laypage.js"></script>
<script type="text/javascript" src="static/axios.min.js"></script>
<script type="text/javascript" src="./static/vue"></script>
<script src="static/element/index.js"></script>
<script type="text/javascript">
    let vm = new Vue({
        el: '#app',
        data: {
            state2: '',
            restaurants: [],
            tableHeightL: 0,
            ryzh: '',   //--人员帐号
            cxfs: '',

            ii_page: 1,   //--上一页下一页的计数器
            ii_row: 20,   //--每页显示的记录数
            iiCount: 0,
            is_search: '',
            tableData: [],      //--具体人员信息表

            sh1st: '',
            sh1cs: '',
            sh2st: '',
            sh2cs: '',

            idSum3: '',
            idSum4: '',
            fullscreenLoading: false,
            lock: false
        },
        methods: {
            fReset() {
                this.ryzh = ''
                this.czfs = ''
                this.state2 = ''
                this.tableData = []      //--具体人员信息表
                this.fGetinfoEmp()
            },

            //--依据人员的帐号去查询人员的信息
            fGetinfoEmp() {
                let ls_opid = "${sessionOpid}";
                let self = this
                let params = new URLSearchParams();
                params.append('CMD', "CA");
                params.append('VALUE01', this.ryzh);
                this.fullscreenLoading = true
                axios.post('/f_wscl/com2', params)
                    .then(function (res) {
                        let {db1, db2} = res.data
                        self.state2 = ''
                        self.tableData = db1
                        self.idSum3 = db2[0].VALUE01
                        self.idSum4 = db2[0].VALUE02
                    })
                    .catch(function (error) {
                        layer.msg('网络异常错误', {icon: 1, time: 1000});
                    }).finally(function () {
                    self.fullscreenLoading = false
                });
            },

            //--按照输入的卡号进行查询
            fSearchKh() {
                let self = this
                layer.prompt({
                    formType: 0,
                    value: '',
                    title: '请读卡',
                    maxlength: 15,
                    area: ['300px', '120px'] //自定义文本域宽高
                }, function (value, index, elem) {
                    if (isNaN(value)) {
                        layer.msg("请读出数字卡号", {icon: 0, time: 2000});
                        return;
                    }
                    self.ryzh = value
                    self.cxfs = 'KH'
                    self.fGetinfoEmp()
                    layer.close(index);
                }, function () {
                });
            },

            fCz() {
                <%--if (parseInt(this.idSum4) === 0) {--%>
                <%--    layer.msg('<span style="font-size:24px; line-height: 30px">原卡数据中没有余额!</span>', {--%>
                <%--        time: 1500,--%>
                <%--        skin: 'fail'--%>
                <%--    });--%>
                <%--}--%>

                <%--let self = this--%>
                <%--let ls_opid = "${sessionOpid}";--%>
                <%--layer.confirm("确定是否将原卡余额转至当前账户？", {--%>
                <%--    btn: ["确定", "取消"] //按钮--%>
                <%--}, function () {--%>
                <%--    if (!this.lock) {--%>
                <%--        this.lock = true--%>
                <%--        this.fullscreenLoading = true--%>
                <%--        let params = new URLSearchParams();--%>
                <%--        params.append('CMD', "BY");--%>
                <%--        params.append('VALUE01', ls_opid)--%>
                <%--        axios.post('/f_wscl/com2', params)--%>
                <%--            .then(function (res) {--%>
                <%--                let {db1} = res.data--%>
                <%--                if (db1[0].VALUE01 === 'ZZ01') {--%>
                <%--                    layer.msg('<span style="font-size:26px; line-height: 30px">' + db1[0].VALUE02 + '</span>', {--%>
                <%--                        time: 2000,--%>
                <%--                        skin: 'fail'--%>
                <%--                    });--%>
                <%--                } else if (db1[0].VALUE01 === 'ZZ00') {--%>
                <%--                    layer.msg("<span style='font-size:26px; line-height: 30px'>余额操作完毕!</span>", {--%>
                <%--                        time: 2000,--%>
                <%--                        skin: 'succeed'--%>
                <%--                    }, function () {--%>
                <%--                        let index = parent.layer.getFrameIndex(window.name);--%>
                <%--                        self.fGetinfoEmp()--%>
                <%--                        parent.layer.close(index);--%>
                <%--                    });--%>
                <%--                }--%>
                <%--            })--%>
                <%--            .catch(function (error) {--%>
                <%--                layer.msg('<span style="font-size:26px; line-height: 30px">网络异常错误!</span>', {--%>
                <%--                    time: 1500,--%>
                <%--                    skin: 'fail'--%>
                <%--                });--%>
                <%--            })--%>
                <%--            .finally(function () {--%>
                <%--                self.lock = false--%>
                <%--                self.fullscreenLoading = false--%>
                <%--            });--%>
                <%--    }--%>
                <%--    //--如下两个备注留着，用来确定是否关闭弹出的界面而不关闭显示流水的列表界面--%>
                <%--    // layer.closeAll('dialog');--%>
                <%--    // layer.close(index);--%>
                <%--}, function () {--%>
                <%--});--%>
            },

            querySearch(queryString, cb) {
                let restaurants = this.restaurants;
                let results = queryString ? restaurants.filter(this.createFilter(queryString)) : restaurants;
                // 调用 callback 返回建议列表的数据
                cb(results);
            },

            createFilter(queryString) {
                return (restaurants) => {
                    return (restaurants.value.toLowerCase().indexOf(queryString.toLowerCase()) >= 0);
                };
            },

            //--输入框选择后的人员帐号
            handleSelect(item) {
                this.ryzh = item.address
                this.fGetinfoEmp()
            },

            tableHeaderCellStyleL({row, column, rowIndex, columnIndex}) {
                let cellStyle1;

                cellStyle1 = "color: #fff;" +
                    "background:#4F4F4F;" +
                    "height:40px;" +
                    "text-align:center;" +
                    "font-size:12px"

                return cellStyle1
            },

            tableCellStyleL({row, column, rowIndex, columnIndex}) {
                let cellStyle1;

                cellStyle1 = "text-align:center;" +
                    "padding:8px 1px 8px;" +
                    "font-size:12px"

                return cellStyle1;
            },

            //--查询出输入框的基础检索数据
            fInit() {
                let ls_opid = "${sessionOpid}";
                let self = this
                let params = new URLSearchParams();
                params.append('CMD', "BV");

                axios.post('/f_wscl/com2', params)
                    .then(function (res) {
                        let {db1, db2} = res.data
                        self.sh1st = db2[0].VALUE03 + '食堂'
                        self.sh1cs = db2[0].VALUE03 + '小卖部'
                        self.sh2st = db2[1].VALUE03 + '食堂'
                        self.sh2cs = db2[1].VALUE03 + '小卖部'
                        self.restaurants = JSON.parse(JSON.stringify(db1).replace(/VALUE01/g, "value")
                            .replace(/VALUE02/g, "address"));
                    })
                    .catch(function (error) {
                        layer.msg('<span style="font-size:24px; line-height: 30px">网络异常错误!</span>', {
                            time: 2000,
                            skin: 'fail'
                        });
                    });
            },

        },
        mounted() {
            window.fGetinfoEmp = this.fGetinfoEmp;
            this.fGetinfoEmp()
        },
        created() {
            let windowHeight = document.documentElement.clientHeight || document.body.clientHeight;
            this.tableHeightL = windowHeight - 85;
            this.fInit()
        }
    });

</script>

</body>
</html>
